﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using EQT.Bll;
using EQT.Model;
using EQT.Dal;
using System.Collections.Generic;

/// <summary>
/// IUploadPage 的摘要说明
/// </summary>
public abstract class IUploadPage:Page
{
    public IUploadPage():base()
    {
         
    }
    public abstract void SetPageTitle(string title);

    public virtual object GetConfigValue(string key)
    {
        return this.ViewState[key];
    }

    public virtual void SetConfigValue(string key, string value)
    {
        this.ViewState[key] = value;
    }
}



public interface IUploadFile
{
    /// <summary>
    /// 初始化上传页面
    /// </summary>
    /// <param name="up"></param>
    /// <param name="nvc"></param>
    void InitUpload(IUploadPage up, System.Collections.Specialized.NameValueCollection nvc);
    int Upload1(IUploadPage up, MoTfiles file,string opter_id);
    int UploadedMuliti(IUploadPage up, List<MoTfiles> files, string opter_id);
    string GetReturnUrl(IUploadPage up);
}


public static class UploadFileFactory
{
    private static Dictionary<string, IUploadFile> ufDic;
    static UploadFileFactory()
    {
        ufDic = new Dictionary<string, IUploadFile>();
        ufDic.Add("docs", new UploadDoc());
        ufDic.Add("parameterfile", new UploadParameterFile());
        ufDic.Add("notice", new UploadNotice());
        ufDic.Add("sample", new UploadSample());
        ufDic.Add("testitem", new UploadTestItem());
        ufDic.Add("nameplate", new UploadNamePlate());
        ufDic.Add("co_testitem_xls", new UploadCoTestItemXls());
        ufDic.Add("report", new UploadReport());
        ufDic.Add("product", new UploadProduct());
        ufDic.Add("task", new UploadTaskRecord());
        ufDic.Add("signature", new UploadSignature());
        ufDic.Add("resultattachment", new UploadResultAttachment());
        ufDic.Add("paratt", new UploadAttachFile());        
    }

    public static IUploadFile GetUF(string upload_mode)
    {
        if (ufDic.ContainsKey(upload_mode))
            return ufDic[upload_mode];
        return null;
    }
}

